/*
   This example code is in the Public Domain (or CC0 licensed, at your option.)

   Unless required by applicable law or agreed to in writing, this
   software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
   CONDITIONS OF ANY KIND, either express or implied.
*/
#ifndef __GATT_SERVER_H__
#define __GATT_SERVER_H__

#include <stdio.h>

/* Attributes State Machine */
enum
{
    IDX_SVC,

    IDX_CHAR_CONFIG_WIFI,
    IDX_CHAR_VAL_CONFIG_WIFI,

    IDX_CHAR_DEVICE_INFO,
    IDX_CHAR_VAL_DEVICE_INFO,

    IDX_CHAR_WIFI_STATE,
    IDX_CHAR_VAL_WIFI_STATE,
    IDX_CHAR_CFG_WIFI_STATE,

    HRS_IDX_NB,
};

typedef struct 
{
    uint8_t head;
    uint8_t len;
    char data[0];
}ble_frame_t;

extern uint8_t gatt_device_info[15];
extern bool notify_state;
extern uint8_t gatt_set_wifi_flag;

extern void gatt_server(void);
extern void gatt_heart_beat(void);
extern void ble_update_msg(void);
extern void ble_update_wifi_state(uint8_t wifi_state, bool notify, bool sendable);
extern void ble_update_device_info(void);
extern void gatt_bt_disconnect(void);

#endif